home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
278_01
/
cxldemo.c
< prev
Wrap
C/C++ Source or Header
|
1990-02-13
|
47KB
|
1,448 lines
/* ┌┬───────────────────────────────────────────────────────────────────┬┐
││ ││
││ CXL Demonstration Program ││
││ ││
││ CXL is Copyright (c) 1987-1989 by Mike Smedley ││
││ ││
││ Syntax: CXLDEMO [-switches] ││
││ ││
││ -c = CGA snow elimination ││
││ -b = BIOS screen writing ││
││ -m = force monochrome text attributes ││
││ ││
││ Compiler command lines: ││
││ ││
││ MSC: cl -Ox cxldemo.c cxlmss.lib ││
││ QC: qcl -Ox cxldemo.c cxlmss.lib ││
││ TC: tcc -Z -O cxldemo.c cxltcs.lib ││
││ ZTC: ztc -msi -o -b cxldemo.c cxlzts.lib ││
││ ││
└┴───────────────────────────────────────────────────────────────────┴┘ */
/*---------------------------------------------------------------------------*/
/* header files */
#include <conio.h>
#include <ctype.h>
#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cxldef.h"
#include "cxlkey.h"
#include "cxlmou.h"
#include "cxlstr.h"
#include "cxlvid.h"
#include "cxlwin.h"
#if defined(__TURBOC__) /* Turbo C */
#include <dir.h>
#else
#include <direct.h> /* all others */
#endif
#if defined(M_I86) && !defined(__ZTC__) /* MSC/QuickC */
#define bioskey(a) _bios_keybrd(a)
#define findfirst(a,b,c) _dos_findfirst(a,c,b)
#define findnext(a) _dos_findnext(a)
#define ffblk find_t
#define ff_name name
#elif defined(__ZTC__) /* Zortech C/C++ */
#define ffblk FIND
#define ff_name name
#define ff_attrib attribute
#endif
/*---------------------------------------------------------------------------*/
/* function prototypes */
static void activate_demo (void);
static void add_shadow (void);
static void chg_attr_demo (void);
static void chg_bord_demo (void);
static void chg_wind_attr (int battr,int wattr);
static int check_date (char *buf);
static void close_windows (void);
static void confirm_quit (void);
static void copy_demo (void);
static void cxlinfo (void);
static void datademo (void);
static void directory (void);
static void display_date (void);
static void disp_sure_msg (void);
static void display_title (int tpos);
static void do_nothing (void);
static void error_exit (int errnum);
static void execute (void);
static int find_first (char *filespec,struct ffblk *ffblk);
static int find_next (struct ffblk *ffblk);
static unsigned get_key (int *done);
static void hide_demo (void);
static void horz_line (int wrow,int wcol,int count,int attr);
static void initialize (void);
static void line_inp_demo (void);
static void main_menu (void);
static void menudemo (void);
static void move_bar_down (void);
static void move_demo (void);
static void move_window (int nsrow,int nscol);
static void normal_exit (void);
static void open_back_wind(void);
static void open_stat_wind(void);
static void open_titl_wind(void);
static void os_shell (void);
static void parse_cmd_line(int argc,char *argv[]);
static void parse_date (char *buf,int *month,int *day,int *year);
static void pick_compiler (void);
static void pickdemo (void);
static void popup_demo (void);
static void pre_help (void);
static void pre_menu1 (void);
static void pre_menu2 (void);
static void pre_pick1 (void);
static void press_a_key (int wrow);
static void pulldown_demo (void);
static void quit_window (void);
static void resize_demo (void);
static void restore_cursor(void);
static void r_margin (void);
static void scroll_demo (void);
static void setup_menu (void);
static void short_delay (void);
static void size_window (int nerow,int necol);
static void text_line_demo(void);
static void title_demo (void);
static void toggle_block (void);
static void toggle_yn (void);
static void update_clock (void);
static void vert_line (int wrow,int wcol,int count,int attr);
static void you_selected (char *str);
static void windemo (void);
/*---------------------------------------------------------------------------*/
/* miscellaneous global variables */
static int *savescrn,crow,ccol;
static WINDOW w[10];
/*---------------------------------------------------------------------------*/
/* fields used in data entry demo */
static char date[7],firstname[16],initial[2],lastname[26],address[41],city[21],
state[3],zipcode[10],phone[11],compiler[16],amtenc[8],comments[41],
ssan[10];
/*---------------------------------------------------------------------------*/
/* months table */
static char *months[]= {
"January","February","March","April","May","June","July","August",
"September","October","November","December",NULL
};
/* printer ports table */
static char *prn_ports[]= { "PRN","LPT1","LPT2","COM1","COM2",NULL };
/* error message table */
static char *error_text[]= {
NULL, /* errnum = 0, no error */
NULL, /* errnum == 1, windowing error */
"Syntax: CXLDEMO [-switches]\n\n"
"\t -c = CGA snow elimination\n"
"\t -b = BIOS screen writing\n"
"\t -m = force monochrome text attributes",
"Memory allocation error"
};
/* compiler table */
static char *compilers[]=
{ "Microsoft C","Quick C","Turbo C","Zortech C/C++" };
/*---------------------------------------------------------------------------*/
/* help category numbers */
#define H_GLOBAL 1
#define H_WINDOWING 2
#define H_MENUING 3
#define H_LISTPICK 4
#define H_STRPICK 5
#define H_FILEPICK 6
#define H_DATAENTRY 7
#define H_EDITKEYS 8
#define H_DATE 9
#define H_FIRSTNAME 10
#define H_INITIAL 11
#define H_LASTNAME 12
#define H_CITY 13
#define H_STATE 14
#define H_ZIPCODE 15
#define H_COMPILER 16
#define H_AMOUNT 17
#define H_NUMERIC 18
#define H_PULLDOWN 19
#define H_FILE 20
#define H_EDITING 21
#define H_LOAD 22
#define H_SAVE 23
#define H_RENAME 24
#define H_NEW 25
#define H_DIRECTORY 26
#define H_EXECUTE 27
#define H_OSSHELL 28
#define H_QUIT 29
#define H_SCROLL 30
#define H_CHGATTR 31
#define H_CHGBORD 32
#define H_WINTITLE 33
#define H_RESIZE 34
#define H_TEXTLINE 35
#define H_WINMOVE 36
#define H_WINHIDE 37
#define H_ACTIVATE 38
#define H_WINCOPY 39
/*---------------------------------------------------------------------------*/
/* miscellaneous defines */
#define SHORT_DELAY 11
/*---------------------------------------------------------------------------*/
void main(int argc,char *argv[])
{
initialize();
parse_cmd_line(argc,argv);
open_back_wind();
open_stat_wind();
open_titl_wind();
main_menu();
normal_exit();
}
/*---------------------------------------------------------------------------*/
static void activate_demo(void)
{
register int i;
if((w[5]=wopen(9,44,22,78,1,LCYAN|_CYAN,WHITE|_CYAN))==0) error_exit(1);
whelpcat(H_ACTIVATE);
wputs("\n CXL's wactiv() is used to"
"\n activate a window, making"
"\n it availa